<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        width: 375px;
        height: 667px;
        border: 1px solid #000;
        position: relative;
      }
      header {
        width: 100%;
        height: 70px;
        border-bottom: 1px solid #000;
        text-align: center;
        line-height: 70px;
      }
      footer {
        position: absolute;
        width: 100%;
        height: 80px;
        left: 0;
        bottom: 0;
        border-top: 1px solid #000;
        display: flex;
        justify-content: space-evenly;
        align-items: center;
      }
      .item {
        width: 335px;
        height: 130px;
        margin: 20px;
        border: 1px solid #000;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <blog></blog>
    </div>

    <script src="../Vue.js"></script>
    <script>
      // 博客的头部组件
      const BlogHeader = {
        template: `
          <header>博客首页</header>
        `,
      };

      //
      const BlogListItem = {
        template: `
          <div class="item">
            <h3>总书记和代表委员的故事</h3>
            <p>“我要给他看看玉麦的新变化”</p>
            <button>点赞</button>
          </div>
        `,
      };

      // 博客的list组件
      const BlogList = {
        template: `
          <main>
            <blog-list-item></blog-list-item>
            <blog-list-item></blog-list-item>
            <blog-list-item></blog-list-item>
          </main>
        `,
        components: {
          BlogListItem,
        },
      };

      // 博客的底部组件
      const BlogFooter = {
        template: `
          <footer>
            <textarea></textarea>
            <button>发布</button>
          </footer>
        `,
      };

      // 全局的最大的博客组件
      const Blog = {
        template: `
          <div class="container">
            <blog-header></blog-header>
            <blog-list></blog-list>
            <blog-footer></blog-footer>
          </div>
        `,
        components: {
          BlogHeader,
          BlogList,
          BlogFooter,
        },
      };

      new Vue({
        el: "#app",
        data: {},
        // 组件注册
        components: {
          Blog,
        },
      });
    </script>
  </body>
</html>
